package com.egao.orderB.service.impl;

import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
import com.egao.orderB.biz.OceanTemplateFeeBiz;
import com.egao.orderB.entity.OceanTemplateFee;
import com.egao.orderB.service.OceanTemplateFeeService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

//import com.egao.orderB.mapper.OceanTemplateFeeMapper;
//import javax.transaction.Transactional;

/**
 * 海运费用模板费用服务实现类
 * @author : Doman
 * @date : 2021-10-19 15:39:59
 * @version ：1.0
 */
@Service
public class OceanTemplateFeeServiceImpl /*extends ServiceImpl<OceanTemplateFeeMapper, OceanTemplateFee> */implements OceanTemplateFeeService {

	@Autowired
	private OceanTemplateFeeBiz oceanTemplateFeeBiz;

  @Override
  public JsonResult list(PageResult2<T> page, OceanTemplateFee oceanTemplateFee, User loginUser)  throws Exception{
    return oceanTemplateFeeBiz.list(page,oceanTemplateFee,loginUser);
  }

  @Override
  public JsonResult list(OceanTemplateFee oceanTemplateFee, User loginUser) {
    return JsonResult.ok().setData(oceanTemplateFeeBiz.list(oceanTemplateFee,loginUser));
  }

  @Override
  public JsonResult getById(OceanTemplateFee oceanTemplateFee) {
    return JsonResult.ok().setData(oceanTemplateFeeBiz.getById(oceanTemplateFee));
  }

  @Transactional
  @Override
  public JsonResult save(OceanTemplateFee oceanTemplateFee, User loginUser) {
    if (oceanTemplateFeeBiz.save(oceanTemplateFee, loginUser)) {
      return JsonResult.ok("添加成功");
    }
    return JsonResult.error("添加失败");
  }

  @Transactional
  @Override
  public JsonResult update(OceanTemplateFee oceanTemplateFee, User loginUser) {
    if (oceanTemplateFeeBiz.update(oceanTemplateFee, loginUser)) {
      return JsonResult.ok("修改成功");
    }
    return JsonResult.error("修改失败");
  }

  @Transactional
  @Override
  public JsonResult remove(OceanTemplateFee oceanTemplateFee, User loginUser) {
    if (oceanTemplateFeeBiz.remove(oceanTemplateFee, loginUser)) {
      return JsonResult.ok("删除成功");
    }
    return JsonResult.error("删除失败");
  }

}
